/**
 * @file MutexLock.h
 * @author your name (you@domain.com)
 * @brief
 * @version 0.1
 * @date 2022-04-05
 *
 * @copyright Copyright (c) 2022
 *
 */

#pragma once

#include "Noncopyable.h"
#include <pthread.h>

namespace wd
{

class MutexLock : Noncopyable
{
  public:
    MutexLock();
    ~MutexLock();

    void lock();
    void unlock();

    pthread_mutex_t *getMutexLockPtr();

  private:
    pthread_mutex_t mutex_;
    bool isLocked_;
};

class MutexLockGuard
{
  public:
    MutexLockGuard(MutexLock &mutex);
    ~MutexLockGuard();

  private:
    MutexLock &mutex_;
};

} // end of namespace wd
